# fix(scoring): single-source fallbacks from DEFAULT_SCORING_CONSTANTS (Fixes #812) - #1107
Conversation
…ixes JSONbored#812) Derive every preview.ts constant() fallback from DEFAULT_SCORING_CONSTANTS instead of duplicated inline literals. Add density-era constants to the defaults map and regression tests proving empty-constants previews match explicit defaults. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1107 +/- ##
=======================================
Coverage 94.79% 94.79%
=======================================
Files 153 153
Lines 18553 18554 +1
Branches 6708 6708
=======================================
+ Hits 17587 17588 +1
Misses 408 408
Partials 558 558 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Note Gittensory command help
Command: Command resultCommands
Findings
Evidence
Next actions
Source and freshness
Additional safe details
Feedback
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
Gittensory is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — if you believe it's mistaken, reopen the PR or ping a maintainer and it will be reviewed. |
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.
|
Hi, @JSONbored |
|
Hi, @JSONbored |
|
Hi, @JSONbored |
Fixes #812
Summary
Remove duplicated fallback literals scattered across
preview.tsand derive every scoring constant lookup fromDEFAULT_SCORING_CONSTANTSinmodel.ts.Problem
Every
constant(constants, "KEY", <literal>)call inpreview.tsduplicated a value already declared inDEFAULT_SCORING_CONSTANTS. When defaults changed (e.g. #807MAX_CONTRIBUTION_BONUS25→5), call-site literals could silently drift. Density-era constants (MIN_TOKEN_SCORE_FOR_BASE_SCORE,MAX_CODE_DENSITY_MULTIPLIER) were not even in the defaults map — only hardcoded at lookup sites.Changes
src/scoring/model.ts— add density-era constants toDEFAULT_SCORING_CONSTANTS;SCORING_CONSTANT_NAMESderives from keys onlysrc/scoring/preview.ts—constant()reads fallbacks fromDEFAULT_SCORING_CONSTANTS; remove all inline literal fallbacks (including feat(scoring): pull + model upstream constants not currently fetched #809 review-collateral and non-code cap constants)test/unit/scoring.test.ts— regression: empty-constants preview matches explicit-defaults preview; density branch retained; density constants no longer flagged as unmodeled driftScope boundary
Does not remove the density-model branch —
current_density_modelremains a supportedactiveModelin types, OpenAPI, andscore-breakdown.ts.API / OpenAPI / MCP contract
No schema changes. Preview math values unchanged when snapshot constants are present.
Validation
Distinct from prior PRs